<script lang="ts" setup>
import type { NotifyItem } from "./type"
const router = useRouter()
import { inject } from 'vue'
const CL: any = inject("$CL");
import { useI18n } from 'vue-i18n';
const { locale, t } = useI18n();//登录国籍
interface Props {
  data: NotifyItem[],
  type: string,
}

const props = defineProps<Props>()

const onGo = (type:string)=> {
  if (type == 'order') {
    router.push('/error-order')
  } else if (type == 'good') {
    router.push('/good/remove-good')
  } else if (type == 'adv') {
    router.push({path:'/adv/ShopAdv',query: { state:2 }})
  }
}


</script>

<template>
  <el-empty v-if="props.data.length === 0" />
  <div v-else>
    <div  class="info-wrapper" v-if="props.type == t('notice.异常订单')">
      <div v-for="(item, index) in props.data" class="info-list" @click="onGo('order')">
        <view class="li">
          <span> {{ $t('notice.异常订单') }}</span>
          <span>2025-1-10 12:12</span>
        </view>
        <view class="li">
          <span>{{ $t('notice.订单状态') }}</span>
          <div class="cancel">{{ $t('notice.买家取消订单') }}</div>
        </view>
        <view class="li">
          <span>{{ $t('notice.订单编号') }}</span>
          <span>12317137813787</span>
        </view>
        <view class="li">
          <span>{{ $t('notice.如有其他疑问，请联系平台客服，谢谢') }}</span>
        </view>
        <el-button type="primary">{{ $t('notice.去处理') }}</el-button>
      </div>
    </div>
    <div  class="info-wrapper" v-if="props.type == t('notice.强制下架的商品')" @click="onGo('good')">
      <div v-for="(item, index) in props.data" class="down-info-list">
        <div class="cancel">{{ $t('notice.强制下架的商品') }}</div>
        <div class="title">{{ $t('notice.具体原因：') }}</div>
        <div class="desc">
          {{ $t('notice.原因') }}
        </div>
        <div class="pla">{{ $t('notice.如有其他疑问，请联系平台客服，谢谢') }}</div>
        <div class="good">
          <el-image src="/static/img/pic.png" fit="fill" ></el-image>
          <div class="desc-w">
            {{ $t('notice.通用汽车桌垫四季冰凉透气全车型') }}
          </div>
        </div>
        <el-button type="primary">{{ $t('notice.去处理') }}</el-button>
      </div>
    </div>
    <div  class="info-wrapper" v-if="props.type ==  t('notice.强制下架的广告')" @click="onGo('adv')">
      <div v-for="(item, index) in props.data" class="down-info-list adv">
        <div class="cancel">{{ $t('notice.强制下架的广告') }}</div>
        <div class="title">{{ $t('notice.具体原因：') }}</div>
        <div class="desc">
          {{ $t('notice.原因') }}
        </div>
        <div class="pla">{{ $t('notice.如有其他疑问，请联系平台客服，谢谢') }}</div>
        <div class="good">
          <el-image src="/static/img/pic.png" fit="fill" ></el-image>
          <div class="desc-w">
            {{ $t('notice.通用汽车桌垫四季冰凉透气全车型') }}
          </div>
        </div>
        <el-button type="primary">{{ $t('notice.去处理') }}</el-button>
      </div>
    </div>
  </div>


</template>

<style lang="scss" scoped>
  .info-wrapper {
    .info-list {
      border-radius: 12px;
      background: #F6F6F6;
      padding: 16px;
      margin-bottom: 16px;
      .li {
        display: flex;
        align-items: center;
        justify-content: space-between;
        color: #4E5969;
        font-size: 16px;
        font-weight: 500;
        margin-bottom: 14px;
        .cancel {
          height: 32px;
          padding: 0 14px;
          color: #FF010B;
          font-size: 14px;
          font-weight: 400;
          display: flex;
          align-items: center;
          border-radius: 2px;
          background: rgba(255, 1, 11, 0.10);
        }
      }
      .el-button {
        width: 100%;
      }
    }

    // 强制下架的商品
    .down-info-list {
      border-radius: 12px;
      background: #F6F6F6;
      padding: 16px;
      margin-bottom: 16px;
      .cancel {
        height: 32px;
        padding: 0 14px;
        color: #FF010B;
        font-size: 14px;
        font-weight: 400;
        border-radius: 2px;
        background: rgba(255, 1, 11, 0.10);
        display: inline-block;
        line-height: 32px;
        margin-bottom: 9px;
      }
      .title {
        color: #4E5969;
        font-size: 15px;
        font-weight: 500;
        margin-bottom: 9px;
      }
      .desc {
        color: #4E5969;
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 13px;
        line-height: 1.6em;
      }
      .pla {
        color: #4E5969;
        font-size: 16px;
        font-weight: 500;
        margin-bottom: 18px;
      }
      .good {
        display: flex;
        align-items: center;
        background: #fff;
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 20px;
        .el-image {
          width: 98px;
          height: 76px;
          margin-right: 8px;
        }
        .desc-w {
          color: #4E5969;
          font-size: 16px;
          font-weight: 500;
        }

      }
      .el-button {
        width: 100%;
        background: #FF474E;
        border: none;
      }
      &.adv {
        .cancel {
          background: rgba(255, 106, 0, 0.10);
          color: #FF6A00;

        }
        .el-button {
          background: #FF6A00;
        }
      }
    }
  }

</style>


<style>
  .liying-notify-info {
    height: calc(100vh - var(--v3-gas-height) - 240px);
  }
</style>
